package com.example.myapplication.AbsFragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.example.myapplication.R;

public abstract class Home extends Fragment {
    protected View mView;
    ListView lvCourseList;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater,
                             @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        if (mView == null) {
            mView = inflater.inflate(getLayoutResourceId(), container, false);
            lvCourseList = mView.findViewById(R.id.list_courses);
            get();
        }
        // 如果 mView 不为空，表示视图已经创建
        return mView;
    }
    // 抽象布局资源ID和Get请求
    protected abstract int getLayoutResourceId();
    public abstract void get();

}
